package src

import (
	"net/http"
	 "fmt"
)

func init() {
	http.HandleFunc("/emias/vehicle/get_offence", transportHandler)
	http.HandleFunc("/transport/registerPayment", payFineHandler)
	http.HandleFunc("/user/subscribtion/v0.1/get", getSubscrHandler)
	http.HandleFunc("/user/subscribtion/v0.1/update", updateSubscrHandler)
	http.HandleFunc("/v0.1/fssp/find", fsspHandler)
	http.HandleFunc("/v0.1/fssp/getPersons", fsspGetPersonsHandler)
    http.HandleFunc("/v0.1/fssp/addPersons", fsspAddPersonsHandler)	
    http.HandleFunc("/v0.1/fssp/updatePersons", fsspUpdatePersonsHandler)
    http.HandleFunc("/v0.1/fssp/deletePersons", fsspDeletePersonsHandler)
    http.HandleFunc("/roadinfo/getSituation", roadinfoHandler)    
	
	http.HandleFunc("/", generalHandler)
}

func generalHandler(w http.ResponseWriter, r *http.Request) {
	methods := []string{"<pre>/emias/vehicle/get_offence</pre>", "<pre>/transport/registerPayment</pre>",
	                    "<pre>user/subscribtion/v0.1/get</pre>","<pre>user/subscribtion/v0.1/update</pre>",
	                    "<pre>/v0.1/fssp/find</pre>","<pre>/v0.1/fssp/getPersons</pre>",
	                    "<pre>/v0.1/fssp/updatePersons</pre>","<pre>/v0.1/fssp/deletePersons</pre>",
	                    "<pre>/v0.1/fssp/addPersons</pre>","<pre>/roadinfo/getSituation</pre>"}
	fmt.Fprintln(w, "Available method stubs:")
	for _,method := range methods {
		fmt.Fprintln(w,method)
	}

}
